import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:skeletons/skeletons.dart';

import '../../../widgets/constraints_widget.dart';
import '../../../widgets/skeleton/custom_skeleton.dart';

//todo:竞标详情和商城详情的骨架屏
class LoadingWidget extends StatelessWidget {
  const LoadingWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: Get.width,
      height: Get.height,
      color: Colors.white,
      padding: EdgeInsets.only(
        bottom: 20.w,
      ),
      child: ListView(
        padding: EdgeInsets.zero,
        children: [
          Container(
            child: ConstraintsWidget(
              width: '100vw',
              height: '100vw',
              child: CustomSkeleton(
                child: SkeletonAvatar(
                  style: SkeletonAvatarStyle(
                    width: double.infinity,
                  ),
                ),
              ),
            ),
          ),
          SizedBox(height: 12),
          Container(
            height: 60.w,
            width: Get.width - 24.w,
            padding: EdgeInsets.symmetric(
              horizontal: 12.w,
            ),
            child: CustomSkeleton(
              child: SkeletonAvatar(
                style: SkeletonAvatarStyle(
                  width: Get.width - 24,
                  height: 60.w,
                ),
              ),
            ),
          ),
          SizedBox(height: 12),
          Container(
            child: CustomSkeleton(
              child: SkeletonParagraph(
                style: SkeletonParagraphStyle(
                  padding: EdgeInsets.zero,
                  lines: 5,
                  spacing: 10,
                  lineStyle: SkeletonLineStyle(
                    randomLength: true,
                    height: 10,
                    borderRadius: BorderRadius.circular(8),
                    minLength: MediaQuery.of(context).size.width / 2,
                  ),
                ),
              ),
            ),
            padding: EdgeInsets.symmetric(
              horizontal: 12.w,
            ),
          ),
          SizedBox(height: 12),
          ...List.generate(
            6,
            (index) => Container(
              padding: EdgeInsets.symmetric(
                horizontal: 12.w,
                vertical: 10.w,
              ),
              child: CustomSkeleton(
                child: SkeletonAvatar(
                  style: SkeletonAvatarStyle(
                    width: Get.width - 24,
                    height: 60.w,
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
